package com.jiawa.train.business.controller.admin;


import com.jiawa.train.business.req.DailyTrainSeatQueryReq;
import com.jiawa.train.business.req.DailyTrainSeatSaveReq;
import com.jiawa.train.business.resp.DailyTrainSeatQueryResp;
import com.jiawa.train.business.service.IDailyTrainSeatService;
import com.jiawa.train.common.resp.CommonResp;
import com.jiawa.train.common.resp.PageResp;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 每日座位 前端控制器
 * </p>
 *
 * @author hrz
 * @since 2025-09-07
 */
@RestController
@RequestMapping("/admin/daily-train-seat")
@RequiredArgsConstructor
public class DailyTrainSeatAdminController {

    private final IDailyTrainSeatService dailyTrainSeatService;

    @PostMapping("/save")
    public CommonResp<Object> save(@Validated @RequestBody DailyTrainSeatSaveReq Req) {
        dailyTrainSeatService.saveDailyTrainSeat(Req);
        return new CommonResp<>();
    }

    @GetMapping("/query-list")
    public CommonResp<PageResp<DailyTrainSeatQueryResp>> queryList(@Validated DailyTrainSeatQueryReq req) {
        PageResp<DailyTrainSeatQueryResp> pa = dailyTrainSeatService.queryList(req);
        return new CommonResp<>(pa);
    }

    @DeleteMapping("/delete/{id}")
    public CommonResp<Object> delete(@PathVariable Long id) {
        dailyTrainSeatService.delete(id);
        return new CommonResp<>();
    }
}
